<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="./static/layui/css/layui.css">
    <style>
        table {
            width: 800px !important;
            margin: 0 auto !important;
        }
    </style>
</head>
<body>
<a href="add.jsp" class="layui-btn layui-btn-danger">添加部门</a><br>
<%-- ${} el表达式 --%>
<p>
<form action="dept?action=list" method="post">
<div class="layui-input-inline layui-input-wrap">
    <input type="text" placeholder="请输入部门名" name="name" value="${dept.name}"  lay-verify="required" autocomplete="off"  lay-affix="clear" class="layui-input ">
</div>
    <button type="submit" class="layui-btn" lay-submit lay-filter="demo1">查询</button>
    <a href="add.jsp" class="layui-btn layui-btn-primary">添加部门</a>
</form>
</p>
<table class="layui-table" lay-even>
    <colgroup>
        <col width="150">
        <col width="150">
        <col>
        <col>
    </colgroup>
    <thead>
    <tr>
        <th>编号</th>
        <th>部门名</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    <c:forEach items="${depts}" var="dept">
        <tr>
            <td>${dept.id}</td>
            <td>${dept.name}</td>
            <td>
                <a href="dept?action=toUpdate&id=${dept.id}" class="layui-btn layui-btn-xs">修改</a>
                <a href="dept?action=delete&id=${dept.id}" class="layui-btn layui-btn-danger layui-btn-xs">删除</a>
            </td>
        </tr>
    </c:forEach>
    </tbody>
</table>

</body>
</html>